1 00:00:00,780 --> 00:00:02,640 ‫Welcome to lecture 11. 2 00:00:02,970 --> 00:00:08,390 ‫Now, before we proceed, I would like to show you how to edit this item with the parameters. 3 00:00:09,000 --> 00:00:14,090 ‫I know that I said that this lecture is going to be covering on Adelaide and we are going to do that. 4 00:00:14,370 --> 00:00:15,690 ‫But before we go, we go there. 5 00:00:15,720 --> 00:00:19,770 ‫Let me just show you how to pass parameters here so that we don't have to code these things. 6 00:00:19,950 --> 00:00:21,990 ‫We pass them from our API. 7 00:00:22,290 --> 00:00:25,020 ‫And so here we are going to expect two things. 8 00:00:25,230 --> 00:00:27,420 ‫And the first thing I'm going to be expecting is their name. 9 00:00:27,870 --> 00:00:30,120 ‫That is going to be the name where we're editing. 10 00:00:30,360 --> 00:00:34,290 ‫And the second thing we're going to be expecting here is their maybe their new. 11 00:00:36,500 --> 00:00:42,770 ‫I think, OK, now we can call it a new item, name something like that new item name, and this is 12 00:00:42,770 --> 00:00:44,030 ‫what is going to go here. 13 00:00:45,960 --> 00:00:52,060 ‫You remember he's going to be formatted string, so he's going to have that and then the name is what 14 00:00:52,060 --> 00:00:53,920 ‫is going to go inside of him. 15 00:00:55,060 --> 00:00:57,530 ‫So delete that and put your name here. 16 00:00:57,610 --> 00:01:11,170 ‫So we are going to be seeing an update tab that said that the name is the new item name and a new item 17 00:01:11,170 --> 00:01:14,090 ‫name and where the name is the name. 18 00:01:14,110 --> 00:01:14,450 ‫OK. 19 00:01:16,540 --> 00:01:19,750 ‫And then are going to commit it and that will be successful. 20 00:01:22,690 --> 00:01:30,910 ‫So what we have done here is we have said update from this table set the item name is the new item name 21 00:01:31,120 --> 00:01:31,800 ‫in the bill. 22 00:01:32,530 --> 00:01:33,400 ‫The name is this name. 23 00:01:33,400 --> 00:01:37,500 ‫And now we can go to our postman with these two items. 24 00:01:37,510 --> 00:01:43,270 ‫We have this and we have name and now we can go to our update function and what we need to do here in 25 00:01:43,270 --> 00:01:43,660 ‫the body. 26 00:01:43,670 --> 00:01:45,240 ‫We need to pass these two parameters. 27 00:01:45,670 --> 00:01:49,010 ‫We will have a name here and we will have this one. 28 00:01:49,300 --> 00:01:52,530 ‫Now, let us now try and update road here. 29 00:01:53,230 --> 00:02:00,730 ‫Let us go ahead and update that item so that the name is that this is very important because it's a 30 00:02:00,730 --> 00:02:01,400 ‫primary key. 31 00:02:01,900 --> 00:02:03,490 ‫So this is all going to go here. 32 00:02:03,530 --> 00:02:04,270 ‫This is easy. 33 00:02:04,540 --> 00:02:10,850 ‫And this is going to be updated that Ippei, I think. 34 00:02:10,960 --> 00:02:11,360 ‫OK. 35 00:02:11,950 --> 00:02:17,080 ‫And then when you send this, maybe I can just change this message a little instead of seeing just it 36 00:02:17,080 --> 00:02:20,000 ‫says it will stay updated. 37 00:02:20,290 --> 00:02:30,950 ‫Item updated, something like that item has been updated, something close to that. 38 00:02:31,010 --> 00:02:32,380 ‫So send it. 39 00:02:33,040 --> 00:02:35,860 ‫You know, this is item has been updated successfully. 40 00:02:36,190 --> 00:02:36,940 ‫Wonderful. 41 00:02:37,140 --> 00:02:39,790 ‫Reloaded, this item reloaded. 42 00:02:40,030 --> 00:02:45,820 ‫And yes, now this one has been updated by using the parameters that we have passed here. 43 00:02:45,850 --> 00:02:48,900 ‫OK, so this are you going to do it from your front end application? 44 00:02:49,210 --> 00:02:49,620 ‫No. 45 00:02:49,960 --> 00:02:53,450 ‫Let's go and cover the purpose for this letter. 46 00:02:53,500 --> 00:03:00,070 ‫This one was supposed to be covering the delete function in ERP next API and therefore we are going 47 00:03:00,070 --> 00:03:06,950 ‫to come back to our API file in this state by Frappier Titlist. 48 00:03:07,930 --> 00:03:09,970 ‫It is our function, so I don't forget. 49 00:03:10,240 --> 00:03:14,100 ‫And then we define our function here, which we're going to call delete item. 50 00:03:16,090 --> 00:03:23,680 ‫And then again, as usual, you're going to hardcoded and then you're going to pass on the key from 51 00:03:23,680 --> 00:03:25,570 ‫our API front end application. 52 00:03:26,020 --> 00:03:31,200 ‫And then here we're going to see Rapido to be brought as well. 53 00:03:32,170 --> 00:03:35,860 ‫So that's to allow us to write our estimate here. 54 00:03:36,190 --> 00:03:37,810 ‫One, two, three, one, two, three. 55 00:03:37,940 --> 00:03:38,710 ‫Remember that. 56 00:03:39,040 --> 00:03:42,760 ‫And then we're going to say not update but delete. 57 00:03:42,910 --> 00:03:44,160 ‫This is normally squill. 58 00:03:44,980 --> 00:03:53,230 ‫So we are going to say delete from our table is tab item saudade from the item and we want to delete 59 00:03:53,230 --> 00:03:57,910 ‫where again, if you don't supply the are close this is going to disappear. 60 00:03:57,910 --> 00:03:59,970 ‫So name equals. 61 00:03:59,980 --> 00:04:04,990 ‫And again, here we are going to parse what we want to delete lasciviously from auditability. 62 00:04:05,020 --> 00:04:09,760 ‫Lodhia, let us delete the fourth item here. 63 00:04:09,780 --> 00:04:17,860 ‫So ATSDR, we can copy this and we bring it to our code and pasted it APIs. 64 00:04:17,920 --> 00:04:18,700 ‫Oh I copied. 65 00:04:19,300 --> 00:04:20,020 ‫Oh sorry. 66 00:04:20,290 --> 00:04:23,860 ‫Let me copy this and then I will of that. 67 00:04:25,510 --> 00:04:33,520 ‫OK, OK, it is copied, I think so we pasted and so delete from that we name because remember this 68 00:04:33,760 --> 00:04:39,310 ‫name, I'm not putting it in his head of their politics because it is only one item limit or something 69 00:04:39,310 --> 00:04:43,930 ‫like item, name, description, you have to put it instead of marketing. 70 00:04:43,940 --> 00:04:48,120 ‫So even in this one, if you put batiks, there's not going to be any problem. 71 00:04:48,670 --> 00:04:56,110 ‫So if you go back to the item so that we see our item go away and then here, remember, we need to 72 00:04:56,110 --> 00:05:00,130 ‫do four appear to be able to commit. 73 00:05:01,890 --> 00:05:07,920 ‫And then we can just written a message saying, I deleted something like that, OK? 74 00:05:08,190 --> 00:05:12,720 ‫You can customize this message to whatever you want to add to the user experience of your application 75 00:05:12,720 --> 00:05:13,700 ‫is going to be superb. 76 00:05:13,750 --> 00:05:17,090 ‫OK, so let's go and transcend this. 77 00:05:17,250 --> 00:05:19,270 ‫Remember, we have done a few a few things here. 78 00:05:19,290 --> 00:05:20,860 ‫We have our way to restore its function. 79 00:05:21,150 --> 00:05:26,580 ‫And the other thing that we need to do, I had this that this already is to add authorization and you 80 00:05:26,580 --> 00:05:27,150 ‫pass in. 81 00:05:27,150 --> 00:05:27,770 ‫You are talking. 82 00:05:27,780 --> 00:05:32,670 ‫OK, so let me send this and we get a deleted deleted. 83 00:05:33,120 --> 00:05:36,520 ‫And when we come here, reload with the item is not there. 84 00:05:36,540 --> 00:05:39,570 ‫It has been deleted from our database reload. 85 00:05:39,690 --> 00:05:41,240 ‫And yes, the item is gone. 86 00:05:41,250 --> 00:05:42,780 ‫It is not in the database. 87 00:05:43,230 --> 00:05:46,080 ‫So how about when we need to pass a parameter. 88 00:05:46,110 --> 00:05:47,850 ‫We we are not going to be deleting one item. 89 00:05:47,850 --> 00:05:49,320 ‫So this item is not one of them. 90 00:05:49,680 --> 00:05:53,250 ‫So if we try and send this again, we are going to be this item. 91 00:05:53,250 --> 00:05:58,060 ‫Yes, but certainly is because we we are returning this message at the end of this function. 92 00:05:58,350 --> 00:06:03,190 ‫So this this thing, there is anything because there is no this item doesn't exist. 93 00:06:03,450 --> 00:06:08,220 ‫So what we need to do is to pass here in our in our method. 94 00:06:08,220 --> 00:06:12,690 ‫We need to pass here the the the name of the item that we need to delete. 95 00:06:13,230 --> 00:06:18,630 ‫Then this name, of course, we are going to make this are formatted string and now we are going to 96 00:06:18,630 --> 00:06:19,820 ‫have his name there. 97 00:06:19,830 --> 00:06:24,140 ‫So it's going to be dynamic, is going to be dynamically deleting items into a database. 98 00:06:24,700 --> 00:06:26,390 ‫Then we go to our API. 99 00:06:26,400 --> 00:06:29,480 ‫Remember, this is going to come from your front end application in the body. 100 00:06:29,880 --> 00:06:33,830 ‫We want to have a form letter of the name and the name. 101 00:06:33,840 --> 00:06:35,520 ‫Now, let us try something else. 102 00:06:36,090 --> 00:06:43,890 ‫We reload, we have work and we can delete updated Adlard Hibiya. 103 00:06:44,160 --> 00:06:52,560 ‫So this is easy is going to be the next goal here for us here and send it in. 104 00:06:52,560 --> 00:06:53,790 ‫This is item deleted. 105 00:06:53,940 --> 00:06:56,130 ‫Confirm and boom. 106 00:06:56,130 --> 00:06:57,840 ‫The item is not there, it is deleted. 107 00:06:58,140 --> 00:07:04,680 ‫So if you pass y y y on this function here, why, why, why, why this going again to go ahead and 108 00:07:04,680 --> 00:07:07,440 ‫delay that item, come back, reload. 109 00:07:07,440 --> 00:07:08,340 ‫The item is gone. 110 00:07:08,370 --> 00:07:09,540 ‫So this is it. 111 00:07:09,540 --> 00:07:14,120 ‫That is how you do a function to delete items into our database. 112 00:07:14,130 --> 00:07:19,620 ‫So up to this point we have been able to get how we have done and we have done a bit and we have done 113 00:07:19,620 --> 00:07:19,970 ‫delete. 114 00:07:20,220 --> 00:07:22,080 ‫So let me see you in the next. 115 00:07:22,090 --> 00:07:24,930 ‫Let's jump in to show you something fancy. 116 00:07:25,380 --> 00:07:25,980 ‫See you then.